﻿using System;
using System.Configuration;

namespace PrintService
{
    public static class ServiceConstants
    {
        /// <summary>
        /// Name of the printer which is called to print barcode.Name is "Gprinter  GP-2120TL" by default
        /// </summary>
        public static string PrinterName
        {
            get { return ConfigurationManager.AppSettings["PrinterName"].ToString(); }
        }

        /// <summary>
        /// Folder which is contained data file.
        /// </summary>
        public static string DataFolder
        {
            get { return ConfigurationManager.AppSettings["DataFolder"].ToString(); }
        }

        public static string TemplateFolder
        {
            get { return ConfigurationManager.AppSettings["TemplateFolder"].ToString(); }
        }

        /// <summary>
        /// Folder which is contained data file.
        /// </summary>
        public static string FileFilter
        {
            get { return ConfigurationManager.AppSettings["FileFilter"].ToString(); }
        }

        /// <summary>
        /// 清空已过期文件时间间隔，每天执行一次
        /// </summary>
        public static long CleanExpiredFilesInterval
        {
            get { return long.Parse(ConfigurationManager.AppSettings["CleanExpiredFilesInterval"].ToString()); }
        }

        /// <summary>
        /// If default printer is correct, set this flag to true and use default printer
        /// else use configured printer in config file.
        /// </summary>
        public static bool UseDefaultPrinter
        {
            get { return Convert.ToBoolean(ConfigurationManager.AppSettings["UseDefaultPrinter"]); }
        }

        /// <summary>
        /// 文件保留时长
        /// </summary>
        public static int MaintainFileTime
        {
            get { return int.Parse(ConfigurationManager.AppSettings["MaintainFileTime"].ToString()); }
        }

        public static int ListenPort
        {
            get { return int.Parse(ConfigurationManager.AppSettings["ListenPort"].ToString()); }
        }

        public static string PrinterBrands
        {
            get { return ConfigurationManager.AppSettings["PrinterBrands"].ToString(); }
        }

        public static string TestTemplates
        {
            get { return ConfigurationManager.AppSettings["TestTemplates"].ToString(); }
        }

        public static string AllowOrigins {
            get { return ConfigurationManager.AppSettings["AllowOrigins"].ToString(); }
        }
    }
}
